<?php
$this->breadcrumbs=array(
	Yii::t('breadcrumb', 'Access control')=>array('/authorization/main'),
	Yii::t('breadcrumb', 'Operations'),
);
?>

<?php $this->renderPartial('_menu'); ?>

<h1><?php echo Yii::t('auth', 'Operations'); ?></h1>

<table class="authTable operationTable" border="0" cellpadding="0" cellspacing="0">

	<tr>

		<th class="nameColumn"><?php echo Yii::t('auth', 'Name'); ?></th>
		<th class="descriptionColumn"><?php echo Yii::t('auth', 'Description'); ?></th>

		<?php if( $isBizRuleEnabled===true ): ?>

			<th class="bizRuleColumn"><?php echo Yii::t('auth', 'Business rule'); ?></th>

			<?php if( $isBizRuleDataEnabled===true ): ?>

				<th class="dataColumn"><?php echo Yii::t('auth', 'Data'); ?></th>

			<?php endif; ?>

		<?php endif; ?>

		<th class="deleteColumn" style="width:60px;">&nbsp;</th>

	</tr>

	<?php $i=0; ?>

	<?php foreach( $authItems as $item ): ?>

		<tr class="<?php echo $i%2===0 ? 'odd' : 'even'; ?>">

			<td><?php echo CHtml::link($item->name, array('authItem/updateOperation', 'name'=>$item->name)); ?></td>
			<td><?php echo CHtml::encode($item->description); ?></td>

			<?php if( $isBizRuleEnabled===true ): ?>

				<td><?php echo CHtml::encode($item->bizRule); ?></td>

				<?php if( $isBizRuleDataEnabled===true ): ?>

					<td><?php echo $item->data!==NULL ? CHtml::encode( @serialize($item->data) ) : ''; ?></td>

				<?php endif; ?>

			<?php endif; ?>

			<td>
				<?php
				echo CHtml::linkButton(Yii::t('auth', 'Delete'), array(
					'submit'=>array('authItem/deleteOperation', 'name'=>$item->name),
					'confirm'=>Yii::t('auth', 'Are you sure to delete this item?')));
				?>
			</td>

		</tr>

		<?php ++$i; ?>

	<?php endforeach; ?>

</table>